from datetime import datetime, timedelta
from sc_engine.messaging import HeartbeatMessage
from sc_engine.apps import messages as msgs

def make_app(app_name, root_config, config):
    app = HeartbeatApp()

    return {
        timedelta(minutes=1) : app.heartbeat,
    }

class HeartbeatApp(object):
    """Send a heartbeat at a regular interval."""

    def heartbeat(self):
        return HeartbeatMessage(datetime.now())

